/*
 * Namable.cpp
 *
 *  Created on: 08.06.2012
 *      Author: sebastian
 */

#include "Namable.h"

using namespace std;

int Namable::idCount_ = 0;
map<string, Namable*> objects_;

Namable::Namable(string const & name)
: name_(name)
{
	objects_.insert(make_pair(name_, this));
}

Namable::~Namable() {
	// remove object from list of objects
	map<string, Namable*>::iterator it = objects_.find(name_);
	if (it != objects_.end())
		objects_.erase(it);
}

string Namable::getName() const
{
	return name_;
}

/*
void Namable::setName(string name)
{
	//objects_.find(name_); //TODO: .first = name; //TODO uncomment... maps doesnt work proberly till now wth... :(
	name_ = name;
}
*/

int Namable::getUniqueId() {
	return Namable::idCount_++;
}

